package cn.mw.cmdb.view;

import cn.hutool.core.bean.BeanUtil;
import cn.mw.cmdb.entity.ModelInfo;
import cn.mw.cmdb.entity.ModelScope;
import cn.mw.cmdb.entity.ModelType;
import cn.mw.cmdb.entity.PropertyTypeString;
import cn.mw.cmdb.enums.ModelViewTypeEnum;
import cn.mw.cmdb.util.DataCreateInfo;
import cn.mw.components.mongodb.anno.CMDBProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;
import java.util.List;

@Data
public class ModelTableView extends DataAuthView implements ViewInfoExtract<ModelInfo>, DataCreateInfo {
    private String id;

    //模型名称
    private String modelName;
    private String modelCode;

    //模型分组id
    private String groupId;

    //继承模型id,父模型的父id
    private List<String> inheritModelIds;

    //父模型id
    private List<String> parentModelIds;

    //模型类型
    private ModelType modelType;

    //模型范围(内置, 自定义)
    private ModelScope modelScope;

    //模型说明
    private String spec;

    //模型图标
    private String icon;

    private List<String> functionModule;
   //模型视图
    protected ModelViewTypeEnum modelViewType;

    //分组路径
    private List<String> groupPath;

    //是否展示
    private Boolean display;

    //创建人
    private Long creater;

    private String createrName;

    private Date createTime;

    //流程纳管开关
    private Boolean enableProManage = false;
    private Integer sortNum;
    public void extractFromModelInfo(ModelInfo modelInfo) {
        BeanUtil.copyProperties(modelInfo, this);
        setOrgs(modelInfo.getOrgs());
    }
}
